<form action="<?php echo HttpUtil::baseUrl();?>/customer/customer/list" method="post" id="dbgridForm">
<div class="dbgrid_form">
    <div class="dbgrid_hidden">
        <input id="advanceSearchStatus" type="hidden" name="advanceSearchStatus" value="0"/>
    </div>
    <div class="dbgrid_form_filter">
        <div class="dbgrid_form_filter_text">
            <div class="dbgrid_form_filter_label">
            <select name="selectOptionFilter">
                <option value="name"><?php echo $this->translate("name"); ?></option>
                <option value="id"><?php echo $this->translate("id"); ?></option>
                <option value="email"><?php echo $this->translate("email"); ?></option>
                <option value="customer_num"><?php echo $this->translate("customerNo"); ?></option>
            </select>
            </div>
            <input id="selectOptionFilterValue" type="text" value="" name="selectOptionFilterValue"/>
        </div>
        <div class="dbgrid_form_filter_btn">
            <input type="button" onclick="javascript:Customer.search();" value="<?php echo $this->translate("goBtn"); ?>" name="dbgridSearch"/>
        </div>
        <div id="dbgrid_form_advance_text" class="dbgrid_form_advance_text" onclick="javascript:DBGrid.showOrHideAdvanceForm();">
            <?php echo $this->translate("advancedSearch"); ?>
        </div>
    </div>
    <div class="clear"></div>
    <div id="dbgrid_advance_filter" class="dbgrid_form_filter" style="display: none;">
        <div class="dbgrid_form_filter_text">
            <div class="dbgrid_form_filter_label">
                <label>ID</label>
            </div>
            <input id="id" type="text" value="" name="id"/>
        </div>
        <div class="dbgrid_form_filter_text">
            <div class="dbgrid_form_filter_label">
                <label>Name</label>
            </div>
            <input id="name" type="text" value="" name="name"/>
        </div>
        <div class="dbgrid_form_filter_text">
            <div class="dbgrid_form_filter_label">
                <label>Email</label>
            </div>
            <input id="email" type="text" value="" name="email"/>
        </div>
        <div class="dbgrid_form_filter_text">
            <div class="dbgrid_form_filter_label">
                <label>Customer #</label>
            </div>
            <input id="customer_num" type="text" value="" name="customer_num"/>
        </div>
        <div class="dbgrid_form_filter_text">
            <div class="dbgrid_form_filter_label">
                <label><?php echo $this->translate("status"); ?></label>
            </div>
            <select id="status" name="status">
                <option selected="selected" value=""><?php echo $this->translate("status"); ?></option>
                <option value="0"><?php echo $this->translate("unactivated"); ?></option>
                <option value="1"><?php echo $this->translate("active"); ?></option>
                <option value="2"><?php echo $this->translate("suspend"); ?></option>
            </select>
       </div>
        <script type="text/javascript">
            $(function() {
                $('#last_login-1').datepicker({
                    changeMonth: true,
                    changeYear: true,
                    dateFormat: 'yy-mm-dd'
                });
            });
            $(function() {
                $('#last_login-2').datepicker({
                    changeMonth: true,
                    changeYear: true,
                    dateFormat: 'yy-mm-dd'
                });
            });
        </script>
        <div class='dbgrid_form_filter_text'>
            <div class='dbgrid_form_filter_label'>
              <label>Last Login</label>
            </div>
            <input type='text' name='last_login-1' id='last_login-1' size='8' value='' />
            <span>&nbsp;-&nbsp;</span>
            <input type='text' name='last_login-2' id='last_login-2' size='8' value='' style='float:none;' />
        </div>
        <script type="text/javascript">
            $(function() {
                $('#last_order-1').datepicker({
                    changeMonth: true,
                    changeYear: true,
                    dateFormat: 'yy-mm-dd'
                });
            });
            $(function() {
                $('#last_order-2').datepicker({
                    changeMonth: true,
                    changeYear: true,
                    dateFormat: 'yy-mm-dd'
                });
            });
        </script>
        <div class='dbgrid_form_filter_text'>
            <div class='dbgrid_form_filter_label'>
              <label>Last Order</label>
            </div>
            <input type='text' name='last_order-1' id='last_order-1' size='8' value='' />
            <span>&nbsp;-&nbsp;</span>
            <input type='text' name='last_order-2' id='last_order-2' size='8' value='' style='float:none;' />
        </div>
        <script type="text/javascript">
            $(function() {
                $('#created-1').datepicker({
                    changeMonth: true,
                    changeYear: true,
                    dateFormat: 'yy-mm-dd'
                });
            });
            $(function() {
                $('#created-2').datepicker({
                    changeMonth: true,
                    changeYear: true,
                    dateFormat: 'yy-mm-dd'
                });
            });
        </script>
        <div class='dbgrid_form_filter_text'>
            <div class='dbgrid_form_filter_label'>
              <label>Created Date</label>
            </div>
            <input type='text' name='created-1' id='created-1' size='8' value='' />
            <span>&nbsp;-&nbsp;</span>
            <input type='text' name='created-2' id='created-2' size='8' value='' style='float:none;' />
        </div>
        <div class="dbgrid_form_filter_btn">
            <input type="button" name="dbgridSearch" value="Advance Search" onclick="javascript:Customer.advanceSearch();"/>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div class="clear"></div>
</form>
<div class="centerbig_form" style="margin-top:10px;">
    <div class="center_top">
        <span class="center_top_title" onclick="Common.gotoUrl('<?php echo HttpUtil::baseUrl();?>/customer/customer')" style="cursor:pointer;"><?php echo $this->translate("customerManage"); ?></span>
        <div class="dbgrid_form_right">
            <div class="dbgrid_form_btn_div" onclick="javascript:Customer.openAddDialog('<?php echo HttpUtil::baseUrl();?>/customer/customer/add');">
                <div class="dbgrid_form_btn_pic">
                    <img src="<?php echo HttpUtil::baseUrl();?>/images/add.gif"/>
                </div>
                <div class="dbgrid_form_btn_text"><?php echo $this->translate("addBtn"); ?></div>
            </div>
        </div>
    </div>
    <div class="right_form_content" style="margin-top:5px;">
        <div class="dbgrid_center_right" id="dbgrid_centerbig">
            <table cellspacing="0" cellpadding="0">
                <thead>
                    <tr>
                        <td colspan="7" class="dbgrid_th_header"><?php echo $this->translate("lastTenCusTitle"); ?></td>
                    </tr>
                    <tr>
                        <td class="dbgrid_th2"><span><?php echo $this->translate("id"); ?></span></td>
                        <td class="dbgrid_th2"><span><?php echo $this->translate("customerNo"); ?></span></td>
                        <td class="dbgrid_th2"><span><?php echo $this->translate("name"); ?></span></td>
                        <td class="dbgrid_th2"><span><?php echo $this->translate("email"); ?></span></td>
                        <td class="dbgrid_th2"><span><?php echo $this->translate("lastLogin"); ?></span></td>
                        <td class="dbgrid_th2"><span><?php echo $this->translate("lastOrder"); ?></span></td>
                        <td class="dbgrid_th2"><span><?php echo $this->translate("createDate"); ?></span></td>
                    </tr>
                </thead>
                <tbody>
                    <?php
                        foreach($this->customers as $customer){
                    ?>
                    <tr onmouseout="javascript:DBGrid.changeRowStyle(this,0);" onmouseover="javascript:DBGrid.changeRowStyle(this,1);" onclick='javascript:Customer.openEditDialog("<?php echo HttpUtil::baseUrl();?>/customer/customer/edit/id/<?php echo $customer['id'] ;?>");' style="cursor:pointer;">
                        <td class="dbgrid_td">&nbsp;<?php echo $this->escape($customer['id']) ;?>&nbsp;</td>
                        <td class="dbgrid_td">&nbsp;<?php echo $this->escape($customer['customer_num']) ;?>&nbsp;</td>
                        <td class="dbgrid_td">&nbsp;<?php echo $this->escape($customer['name']) ;?>&nbsp;</td>
                        <td class="dbgrid_td">&nbsp;<?php echo $this->escape($customer['email']) ;?></td>
                        <td class="dbgrid_td">&nbsp;<?php echo $this->escape($customer['last_login']) ;?>&nbsp;</td>
                        <td class="dbgrid_td">&nbsp;<?php echo $this->escape($customer['last_order']) ;?>&nbsp;</td>
                        <td class="dbgrid_td">&nbsp;<?php echo $this->escape($customer['created']) ;?>&nbsp;</td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<div class="clear"/>

<div style="display:none" id="customerDialog">
</div>
<input type="hidden" value="<?php echo HttpUtil::baseUrl();?>/customer/customer/getlast" id="reloadUrl" />
